//gmsh version: 4.13.1
// 设置网格显示选项
Mesh.SurfaceFaces = 0;  // 显示3D单元的面
Mesh.VolumeEdges = 1;   // 显示3D单元的边
Mesh.Nodes = 1;         // 显示节点
Mesh.SaveAll = 1;       // 导出所有单元
Mesh.ElementOrder = 3;  // 设置网格为二阶

N_layers = 1;         // 横断面网格沿着轴向拉伸的次数
lc = 4;
// 定义横断面
Point(1) = {-1, -1, -1, lc};
Point(2) = {1, -1, -1, lc};
Point(3) = {1, 1, -1, lc};
Point(4) = {-1, 1, -1, lc};


// 定义边界
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};


// 定义横断面
Curve Loop(1) = {1, 2, 3, 4};
Plane Surface(1) = {1};

Recombine Surface {1}; // 定义横断面网格为四边形网格

// 拉伸横断面生成箱梁
extrudeZ[] = Extrude {0, 0, 2} {
  Surface{1};
  Layers{N_layers}; 
  Recombine;
};

// 生成网格
Mesh 3;
Save "cube.inp";